<%@page import="com.dfhc.util.DateUtil"%>
<%@page import="java.sql.Date"%>
<%@page import="com.dfhc.ISystemConstant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/GX_css/base.css" />
<link  type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/GX_css/jquery-ui.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/GX_css/info-mgt.css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/GX_css/WdatePicker.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/activiti/jquery-1.8.3.js"></script>
<%-- <script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/jquery-1.10.1.js"></script> --%>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/common.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/info-mgt.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/GX_js/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/rm-tools.js"></script>
<link href="<%=request.getContextPath()%>/css/activiti/jquery.portlet.min.css?v=1.1.2" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/css/activiti/jquery.qtip.css?v=1.1.2" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/activiti/workflow.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/activiti/jquery.qtip.pack.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/activiti/jquery.outerhtml.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/myalert.js"></script>


<title>办公自动化系统</title>
<style type="text/css">
    .richeng_dialog{ width:510px; height:550px; background:#FFFFFF; position: fixed; top:20%; border-radius:4px;  border:1px solid #C5C5C5;}
    .richeng_dialog_title{ width:98%; height:40px; background:#E9E9E9; padding-left:10px;  border-radius:4px; margin-bottom:5px; line-height: 40px;}
    .richeng_dialog_title div:nth-child(1){width:50%; height:100%; float: left;}
    .richeng_dialog_title div:nth-child(2){width:48%; height:100%; float: right; text-align: right; margin-right: 2%;}
    .richeng_dialog ul{display: block; float: left; width:100%; height:auto; height:40px;}
    .richeng_dialog ul:hover li{background:#E5E5E5;}
    .richeng_dialog ul li{float: left;   height:30px; line-height: 30px; font-size: 13px; color: #666666;}
    .richeng_dialog ul li:nth-child(1){width:10%;}
    .richeng_dialog ul li:nth-child(2){width:20%;}
    .richeng_dialog ul li:nth-child(3){width:70%;}
    .abClick{width:99.6%; height:40px; float:left; margin:2px 0; border:1px solid #C0BFAD; border-radius:2px; background:#F1F7F9;}
	.abClick > div{float:left; width:60px; height:30px; background:#F6F6F6; border:1px solid#C5C5C5; border-radius:4px; margin:8px 10px 0 10px; cursor:pointer; line-height:30px; text-align:center;}
    #bigAuditInfo ul li{height: auto;word-wrap: break-word; }
     #bigAuditInfo ul:after,#bigAuditInfo ul:before{
    display: table;
    content:'';
    visibility: hidden;
    }
     #bigAuditInfo ul{
     
        clear:both;
     }
     .fujian{background:url(images/u390.png) no-repeat left center;background-size:15px 15px;display:block;  padding-left: 18px;color:#666;}
     .msgshi{background:url(images/u966.png) no-repeat left center;background-size:15px 15px;padding-left:18px;cursor: pointer;}
     table#need-border{
     
       width: 260px;
       padding: 0;
       border-collapse: collapse;
       cellspacing:0;
        cellpadding:0;
     }
     
     #need-border td{width: 50%;text-align: left;border: 1px solid #ccc;word-break:break-all;}
</style>
</head>
<% java.util.Date nowTime =DateUtil.getNowDate(); %>
<body>
<div class="title"><h2>我的工作处理</h2></div>
<div class="query">
	<form id="form" name="form" action="<%=request.getContextPath()%>/workprocess"  method="post">
	<input name="startSign" id="startSign" type="hidden"/>
	<div class="query-conditions ue-clear">
         <div class="conditions staff ue-clear">
            <label>流程名称：</label>
            <input type="text" id="procName" name="procName" placeholder="可以直接输入" />
        </div>
        <div class="conditions operate-time ue-clear">
            <label>发起时间：</label>
            <div class="select-wrap">
                <div class="select-title ue-clear" id="startTimeSign"><span>大于或等于</span><i class="icon"></i></div>
                <ul class="select-list">
                    <li>小于</li>
                    <li>大于</li>
                    <li>小于或等于</li>
                </ul>
            </div>
            <div class="input-box ue-clear">
                <input name="startTimeHours" id="startTimeHours" type="text" />
                <span>小时</span>
            </div>
        </div>
        <%-- 
        <div class="conditions time ue-clear">
            <label>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间：</label>
            <div class="time-select">
            	<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="开始时间" />
                <i class="icon"></i>
            </div>
            <span class="line">-</span>
            <div class="time-select">
            	<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="截止时间" />
                <i class="icon"></i>
            </div>
        </div>
        --%>
        <div class="conditions staff ue-clear">
            <label>人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;员：</label>
            <input type="text" id="pname" name="startPerson" placeholder="可以直接输入或选择" />
            <a href="javascript:;" onclick="javascript:chooseStartPerson();" class="staff-select">选择</a>
        </div>
    </div>
    <input name="pid" id="pid" type="hidden" />
    <div class="query-btn ue-clear">
    	<a href="javascript:;" onclick="javascript:query();" style="width:88px;color:#fff; background:#6ab96e; font-size:14px;">查询</a>
        <a href="javascript:;" onclick="javascript:empty();" class="clear">清空条件</a> 
    </div>
    </form>
</div>
<!--<div class="table-operate ue-clear">-->
    <!--<a href="javascript:;" class="title"><h2>待处理工作</h2></a>-->
    <!--&lt;!&ndash;<a href="javascript:;" class="title">理工作</a>&ndash;&gt;-->
	<!--<a href="javascript:;" class="add">添加</a>-->
    <!--<a href="javascript:;" class="del">删除</a>-->
    <!--<a href="javascript:;" class="edit">过滤</a>-->
    <!--<a href="javascript:;" class="count">统计</a>-->
    <!--&lt;!&ndash;<a href="javascript:;" class="check">处理</a>&ndash;&gt;-->
    <!--<a href="javascript:;" class="check">日志</a>-->
<!--</div>-->
<div class="table-box">
	<table>
    	<thead>
        	<tr>
            	<th class="num">序号</th>
                <th class="name">发起人</th>
                <th class="process">流程名称</th>
                 <th class="name">流程标题</th>
                <th class="node">当前节点</th>
                <th class="curtime">发起时间</th>
                <th class="time">状态<span>（及说明）</span></th>
                <th class="operate">操作</th>
            </tr>
        </thead>
        <tbody>
        	<c:forEach items="${taskVos }" var="taskVo" varStatus="rowCounter" begin="0" step="1">
	        	<tr>
	            	<td class="num">${rowCounter.index+1 }</td>
	                <td class="name">${taskVo.startName }</td>
	                <td class="process">${taskVo.procDefName }</td>
	                <td class="name">${titles[rowCounter.index]}</td>
	                <td class="node">${taskVo.curTaskName }</td>
	                <td class="curtime">${taskVo.createTime }</td>
	                <c:if test="${empty taskVo.assignee }">
	                	<td class="time">待签收</td>
	                	<td class="operate">
		                    <a href="workprocess/claim/${taskVo.id }" class="img"><img src="images/titleico.png" /><span>签收</span></a>
		                </td>
	                </c:if>
	                <c:if test="${not empty taskVo.assignee }">
	                	<td class="time">待办理</td>
	                	<td class="operate">
		                    <a href="javascript:;" onclick="javascript:handle('${taskVo.processDefinitionId }','${taskVo.processInstanceId }','${taskVo.id }');" class="img"><img src="images/titleico.png" /><span class="confirm">办理</span></a>
		                </td>
	                </c:if>
	                <%-- 
	                <td class="operate">
	                    <a href="javascript:;" class="img"><img src="images/titleico.png" /></a><span class="confirm" >工作处理</span>
	                </td>
	                --%>
            	</tr>
            </c:forEach>
        </tbody>
    </table>
</div>
<div class="pagination ue-clear"></div>



    <div class="myDialog" id="myDialog">
    	<div class="abClick">
        <div class="aClick">正文</div><div class="bClick" >流程</div></div>
    	<form id="auditForm" name="auditForm" action="#" method="post">
        <div class="myDialog_box clearfix" id="myDialog_box1" style="height:auto;">
            <div class="myDialog_left left">
                <table id="formhtml">
                    <tr>
                        <td>单据编号：</td>
                        <td><input type="text" name="orderNo"></td>
                        <td>经办人单位：</td>
                        <td><input type="text" name="orderPeople" style="width:260px;"></td>
                    </tr>
                    <tr>
                        <td>合计金额：</td>
                        <td><input type="text" name="orderMoney"></td>
                        <td>费用承担部门：</td>
                        <td><input type="text" name="orderDepartment" style="width:260px;"></td>
                    </tr>
                    <tr>
                        <td style="padding-left:0;">
                            <table>
                             <tr><td style=" border-bottom: 1px solid#C0BFAD">预算类别：</td></tr>
                             <tr><td>劳务费：</td></tr>
                             </table>
                        </td>
                        <td style="padding-left:0;">
                            <table>
                             <tr><td style=" border-bottom: 1px solid#C0BFAD"><input type="text" name="orderType"></td></tr>
                             <tr><td><input type="text" name="orderServiceMoney"></td></tr>
                             </table>
                        </td>
                        <td>备注：</td>
                        <td><textarea name="comment" class="textarea">这里写内容</textarea></td>
                    </tr>
                </table>
               
                <div id="myDialog_left_title">
                    <div>发起人附言：<span>附言内容显示</span></div>
                    <div>处理人意见区 (共<span id="auditOpinionNum">1</span>条)</div>
                </div>
                
               <div class="div_title">
                    <ul>
                        <li style="width:24.7%;" id="ul_title">姓名</li>
                        <li style="width:24.7%;" id="ul_title">处理结果</li>
                        <li style="width:24.7%;" id="ul_title">处理意见</li>
                        <li style="width:24.7%;" id="ul_title">处理时间</li>
                        <%-- <li id="ul_title">操作</li>--%>
                    </ul>
                </div>
                <div id="bigAuditInfo">
                <ul style="background:red">
                    <li>张三</li>
                    <li>同意</li>
                    <li>好</li>
                    <li>2017-12-31</li>
<!--                     <li>回复</li> -->
                </ul>
                </div>
                <div id="div_footer">
                    <ul>
                        <li id="ul_title">共<span id="auditPageCount">1</span>页</li>
                        <li id="ul_title">第<span id="auditPageNow">1</span>页</li>
                        <li id="ul_title">
                            <div class="go_next right" onclick="auditPage('0')">
                                >
                            </div>
                            <div class="go_prev right" onclick="auditPage('1')">
                                <
                            </div>
                        </li>
                        <li id="ul_title">数据显示</li>
                    </ul>
                </div>
            </div>
            <div class="myDialog_right left" style="padding-top:0px;">
                <div class="myDialog_right_box">
                    <div class="myDialog_right_box_top clearfix" style="height:40px;line-height:40px;">
                        <div><span>》</span><strong id="taskNodeName">协同</strong></div>
                        
                         <!-- <a href="#">  <img src="" alt="附件列表"> -->
                            <span class="fujianXiazai fujian right">附件列表</span>
                        <!-- </a>-->
                        
                    </div>
                    <div class="myDialog_right_box_center clearfix" style="min-height:250px;height:auto;">
                        
                        	<input type="hidden" id="auditTaskId"/>
                        	<input type="hidden" id="temporaryId" name="temporaryId"/>
                        	
                        	<div class="clearfix">
                        	   
                        	 <div class="myDialog_right_box_center_left left" style="width:auto;">
                                <input type="radio" name="isPass" checked="checked" value="1"><label for="">同意</label>
                                <input type="radio" name="isPass" value="0"><label for="">不同意</label>
                            </div>
                            <div class="myDialog_right_box_center_right right" style="width:auto;">
                                <span class="changYY_dialog">常用语</span>
                            </div>
                        	
                        	</div>
                           
                            <div class="textarea_box" style="max-height:190px;overflow:hidden;">
                                <textarea id="auditOpinion" name="auditOpinion" style="border:none;resize: none;"></textarea>
                            </div>
                            <div class="xiaoxi clearfix">
                            	
                            	<div class="left">
	                            	<label>
	                            	
		                            	<input  type="checkbox" name="isAddCommonLanguage" id="isAddCommonLanguage"/>
		                            	<span >添加到常用语</span>
	                            	</lable>
                            	
                            	</div>
                               <!-- <img src="images/u966.png" alt="消息"> 
                                <span class="msgshi right" style="display:block;"> 消息发送</span>-->
                            </div>
                        
                    </div>
                    <div class="myDialog_right_box_bottom ">
                        <input type="button" onclick="javascript:completeZd();" id="submitClick" value="提交">
                        <input type="button" onclick="javascript:temporary();" id="saveTemporary" value="存为草稿">
<!--                         <input type="button" value="暂存待办"> -->
                    </div>
                </div>
            </div>
        </form>
        </div>
        <div class="myDialog_box myDialog_box_liucheng left" id="myDialog_box2">
            <div class="myDialog_box_liucheng_left left" id="shi_process" style="padding:1px;">
<!--                 <iframe id="iframesrc" src="http://www.baidu.com" width="100%" height="100%" style="padding:0;"></iframe> -->
            </div>
            <div class="myDialog_box_liucheng_right right">
                <div class="myDialog_box_liucheng_right_title">
                    <span>审批状态</span>
                    <a href="#">
                        <img src="images/u390.png" alt="附件列表">
                        <span  class="fujianXiazai">附件列表</span>
                    </a>
                </div>
                <div class="myDialog_box_liucheng_right_list">
                    <div>
                        <ul>
                            <li>序号</li>
                            <li>审批人</li>
                            <li>审批状态</li>
                        </ul>
                    </div>
                    <div id="minAuditHtml">
                    <ul>
                        <li>1</li>
                        <li>张三</li>
                        <li>同意</li>
                    </ul>
                    <ul>
                        <li>2</li>
                        <li>李四</li>
                        <li>不同意</li>
                    </ul>
                    <ul>
                        <li>3</li>
                        <li>王五</li>
                        <li>同意</li>
                    </ul>
                    </div>
                </div>
               
            </div>
        </div>
        
    </div>

    <div class="fujian_dialog"  style="display:none;">
        <form action="##">
        	<div id="fujiandown">
            <ul>
                <li><input type="checkbox" name="fujian"></li>
                <li>1</li>
                <li>附件名称</li>
            </ul>
            </div>
        </form>
    </div>

    <div class="changyongyu_dialog" id="changyongyu_dialog" style="display:none;">
        <div id="commonLanguage">
            <ul>
                <li><input type="checkbox" name="changyongyu"></li>
                <li>1</li>
                <li>常用语内容</li>
            </ul>
            <ul>
                <li><input type="checkbox" name="changyongyu"></li>
                <li>2</li>
                <li>常用语内容</li>
            </ul>
            <ul>
                <li><input type="checkbox" name="changyongyu"></li>
                <li>3</li>
                <li>常用语内容</li>
            </ul>
        </div>
    </div>
    
    <div class="richeng_dialog" style="display:none;">
        <form action="##" name="userMessageForm">
        	<ul>
                <li>选择</li>
                <li>序号</li>
                <li>名称</li>
            </ul>
        	<c:forEach items="${userVos }" var="userVo" varStatus="rowCounter" begin="0" step="1">
            <ul>
                <li><input type="checkbox" id="checkUser" name="checkUser" value="${userVo.id }"></li>
                <li>${rowCounter.index+1 }</li>
                <li>${userVo.name }</li>
            </ul>
            </c:forEach>
        </form>
    </div>
</body>

<script type="text/javascript">
$('.aClick').css('background','#E8E5E5');
    $('.aClick').click(function(){
		$('#myDialog_box2').hide();
		$('#myDialog_box1').show();
$('.aClick').css('background','#E8E5E5');
		$('.bClick').css('background','#F6F6F6');
	});

$('.richeng_dialog').dialog({
	autoOpen:false,
	title:'选择人员',
	modal:true,
	resizable:false,
	width:500,
	height:500,
	buttons:{	
		'提交':function(){
			var ckvId =''; 
    		var ckvName = '';
			$('.richeng_dialog').find('input[id="checkUser"]:checked').each(function(){ 
    			if(ckvId==''){
    				ckvId = $(this).val();
    				ckvName = $(this).parent().parent().children().last()[0].innerText;
    			}else{
    				ckvId += ','+$(this).val();
    				ckvName += ','+$(this).parent().parent().children().last()[0].innerText;
    			}
    		});
			$('#pname').val(ckvName);
			$('#pid').val(ckvId);
			$('.richeng_dialog').dialog('close');
		},
	}
});

$(".select-title").on("click",function(){
	$(".select-list").hide();
	$(this).siblings($(".select-list")).show();
	return false;
})
$(".select-list").on("click","li",function(){
	var txt = $(this).text();
	$(this).parent($(".select-list")).siblings($(".select-title")).find("span").text(txt);
})

$('.pagination').pagination(${pageCount},{
	callback: function(page){
		window.location.href="<%=request.getContextPath()%>/workprocess?page="+(page+1)+"&date="+new Date();
		//alert(page);	
	},
	display_msg: true,
	setPageNo: true,
	current_page:${currentPage-1}
});

$("tbody").find("tr:odd").css("backgroundColor","#eff6fa");

showRemind('input[type=text], textarea','placeholder');

$(function(){	
	if("${message }"!=""){
		zfalert("提示信息",'${message }',"");
	}
});

function query(){
	var startTimeSign = $('#startTimeSign span').text();
	if($("#startTimeHours").val()!=""){
		$("#startSign").val(startTimeSign);
	}
	form.submit();
	//alert("查询!!!");
}

//显示人员选择层
function chooseStartPerson(){
	$('.richeng_dialog').dialog('open');
}

//清空查询条件
function empty(){
	$('#pname').val('');
	$('#pid').val('');
	$('#startTimeHours').val('');
	$('#procDefName span').text('请选择');
	$('#startTimeSign span').text('大于或等于');
}

//展示办理详情
var pid='';
var pdid='';
function handle(processDefinitionId, processInstanceId, taskId){
	pid=processInstanceId;
	pdid=processDefinitionId;
	$.ajax({
	    type:'post',//可选get
	    url:'<%=request.getContextPath()%>/workprocess/getFormData?date='+new Date(),
	    data:{'processDefinitionId':processDefinitionId,'taskId':taskId},
	    dataType:'json',
	    async:false , //false为同步
	    success:function(data,status){
		  if(data.status=="0"){
			  	zfalert("提示信息",data.message,"");
	   	   }else{
	   		   	//form表单拼接
	   		   	var formDataList = data.formDataList;
	   		   	var startFormDataList = data.startFormDataList;
	   		   	var startFormDataValueMap = data.startFormDataValueMap;
	   		 	var enumTypeMap = data.enumTypeMap;
	   		   	var formHtml = operFormDateHtml(startFormDataList, formDataList, startFormDataValueMap, enumTypeMap);
				$('#formhtml').html(formHtml);
				
				//设置审核框标题
				if(!isStrEmpty(startFormDataValueMap)){
					$('.myDialog').dialog({title:startFormDataValueMap.<%=ISystemConstant.PROCESS_FIX_FORM_PROPERTY%>});
				}
				
				//大的审核意见
				var auditInfos = data.auditInfoVos;
				var bigAuditHtml = operBigAuditHtml(auditInfos);
				$('#bigAuditInfo').html(bigAuditHtml);
				//大的审核意见条数
				$('#auditOpinionNum').html(auditInfos.length);
				
				//节点名称
				$('#taskNodeName').html(data.taskNodeName);
				
				//小的审核意见(流程图旁边)
				var minAuditHtml = operMinAuditHtml(auditInfos);
				$('#minAuditHtml').html(minAuditHtml);
				
				//审核常用语
				var commonLanguageVos = data.commonLanguageVos;
				var commonLanguageHtml = operCommonLanguage(commonLanguageVos);
				$('#commonLanguage').html(commonLanguageHtml);
				
				//暂存的审核意见
				var temporaryMap = data.temporaryMap;
				var auditOpinion = temporaryMap.auditOpinion;
				if(auditOpinion!='' && auditOpinion!='undefined'){
					$('#auditOpinion').val(auditOpinion);
					$('#temporaryId').val(temporaryMap.temporaryId);
				}
				
				//附件列表
				if(!isStrEmpty(data.startFormDataValueMap)){
					var fileList = data.startFormDataValueMap.fileList;
					var fileListHtml = '';
					if(!isStrEmpty(fileList)){
						fileListHtml = operFileList(fileList);
					}
					$('#fujiandown').html(fileListHtml);
				}
	   	   }		
	   },
	   error:function(xhr,s1,s2){
	    	var message = xhr.responseText;
			eval("var json = "+message);
			if($.trim(json.error).length==0){
				zfalert("提示信息","数据异常,请刷新页面重试","");
			}else{
				zfalert("提示信息",json.error,"");
			}
	   }
	});
	
	//给隐藏任务id赋值
	$("#auditTaskId").val(taskId);
<%-- 	var srcurl = "<%=request.getContextPath()%>/workflow/diagram-viewer/index.html?processDefinitionId="+processDefinitionId+"&processInstanceId="+processInstanceId; --%>
// 	$('#iframesrc').attr('src',srcurl);
	$('.myDialog').dialog('open');
}

//TODO 
$('.bClick').click(function(){
	$('#myDialog_box1').hide();
	 var url = "${pageContext.request.contextPath}/workflow/diagram-viewer/index.html?processDefinitionId="+pdid+"&processInstanceId="+pid;

	   var imageUrl= "${pageContext.request.contextPath}/workflow/resource/process-instance?pid=" +pid+ "&type=image&time="+new Date();
	   var traceUrl= "${pageContext.request.contextPath}/workflow/process/trace?pid=" +pid+"&time="+new Date();

	   
	var options={
			'pid':pid,
			'pdid':pdid,
			'url':url,
			'imageUrl':imageUrl,
			'traceUrl':traceUrl
			
	
	};
	
	$("#shi_process").html('<div id="imgDialog"><iframe src="' + url + '" width="100%" height="' + document.documentElement.clientHeight * 0.70 + '" /></div>');
	
	graphTrace(options);
	$('#myDialog_box2').css({"background-color":"#fff"});
	$('.bClick').css('background','#E8E5E5');
	$('.aClick').css('background','#F6F6F6');
	$('#myDialog_box2').show();
  
});



$('#changyongyu_dialog').dialog({
	autoOpen:false,
	title:'常用语',
	modal:true,
	resizable:false,
	width:400,
	height:300,
	buttons:{
		'确定':function(){
				var ckvName =''; 
				$('input[name="changyongyu"]:checked').each(function(){ 
					if(ckvName==''){
						ckvName = $(this).parents('ul').find('li:last').text();
					}else{
						ckvName += '\r\n'+$(this).parents('ul').find('li:last').text();	
					}
				}); 
				$("#auditOpinion").val(ckvName);
				$('#changyongyu_dialog').dialog('close');
			},
		}
});

//评价文件列表
function operFileList(fileList){
	var html = '';
	for(var i=0;i<fileList.length; i++){
		var file = fileList[i];
		var path = file.<%=ISystemConstant.PROCESS_FILE_PATH%>;
		path = path.replace(/\\/g,'\\\\');
		var fileName = file.<%=ISystemConstant.PROCESS_FILE_NAME%>;
		html += '<ul>';
		//html += '<li><input type="checkbox" name="fujian"></li>';
		html += '<li>'+(i+1)+'</li>';
		html += '<li style="width:90%;"><a href="javascript:;" onclick="downFile(\''+path+'\',\''+fileName+'\');">'+fileName+'</a></li>';
		html += '</ul>';
	}
	return html;
}

function downFile(path, fileName){
	var path1 = encodeURI(encodeURI(path));
	window.location.href="<%=request.getContextPath()%>/workprocess/downloadFile?path="+path1+"&fileName="+fileName;
}

//拼接常用语
function operCommonLanguage(commonLanguageVos){
    var html = '';
    for(var i=0; i<commonLanguageVos.length; i++){
        var commonLanguage = commonLanguageVos[i];
        html += '<ul>';
        html += '<li><input type="checkbox" name="changyongyu"></li>';
        html += '<li>'+(i+1)+'</li>';
        html += '<li><a title="'+commonLanguage.businessAttribute70+'" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">'+commonLanguage.businessAttribute70+'<a/></li>';
        html += '</ul>';
    }
    return html;
}

//拼接小的审核意见块
function operMinAuditHtml(auditInfos){
	var html = '';
	for(var i=0; i<auditInfos.length; i++){
		var minAuditInfo = auditInfos[i];
		html +='<ul>';
		html += '<li>'+(i+1)+'</li>';
		html += '<li>'+minAuditInfo.auditName+'</li>';
		html += '<li>'+minAuditInfo.auditState+'</li>';
		html += '</ul>';
	}
	return html;
}
//拼接大的审核意见块
function operBigAuditHtml(bigAuditInfos){
	var html = '';
	for(var i=0; i<bigAuditInfos.length; i++){
		var bigAuditInfo = bigAuditInfos[i];
		var page = (i-i%5)/5+1;
		if(page == 1){
			html += '<ul class="ul'+page+'">';
		}else{
			html += '<ul class="ul'+page+'" style="display:none;">';
		}
		html += '<li style="width:24.7%;">'+bigAuditInfo.auditName+'&nbsp;</li>';
		html += '<li style="width:24.7%;">'+bigAuditInfo.auditState+'&nbsp;</li>';
		html += '<li style="width:24.7%;">'+bigAuditInfo.auditOpinion+'&nbsp;</li>';
		html += '<li style="width:24.7%;">'+bigAuditInfo.auditTime+'&nbsp;</li>';
		html += '</ul>';
	}
	$("#auditPageCount").html((bigAuditInfos.length-bigAuditInfos.length%5)/5+1);
	return html;
}

//拼接流程form表单数据
function operFormDateHtml(startFormDataList, formDataList, startFormDataValueMap, enumTypeMap){
	var formHtml = '';
	for(var i=0; i<startFormDataList.length; i++){
		var startFormData = startFormDataList[i];
		if(i%2==0){
  			formHtml += '<tr>';
  			formHtml += operHtml(startFormData, '1', startFormDataValueMap, enumTypeMap);//1 表示只读属性
  		}else{
  			formHtml += operHtml(startFormData, '1', startFormDataValueMap, enumTypeMap);
  			formHtml += '</tr>';
  		}
	}
	/* for(var i =0; i<formDataList.length; i++){
		var formData = formDataList[i];
		if(i%2==0){
  			formHtml += '<tr>';
  			formHtml += operHtml(formData, '0', '', '');
  		}else{
  			formHtml += operHtml(formData, '0', '', '');
  			formHtml += '</tr>';
  		}
	} */
	return formHtml;
}

//判断数据类型,展示不同的标签
function operHtml(formData, readOnly, startFormDataValueMap, enumTypeMap){
	var html = '<td>'+formData.name+'：</td>';
	var namesign = formData.id;
	if(formData.type.name=='string'){//input标签
		if(readOnly=='1'){
			html += '<td><input type="text" readonly="readonly" value="'+((startFormDataValueMap[namesign] != undefined && startFormDataValueMap[namesign] != "")?startFormDataValueMap[namesign]:"")+'"></td>';	
		}else{
			html += '<td><input type="text" name="'+formData.id+'" value="'+formData.value+'"></td>';			
		}
	}else if(formData.type.name=='enum'){
		if(readOnly=='1'){
			var value = startFormDataValueMap[namesign];
			var list = enumTypeMap[namesign];
			for(var i=0; i<list.length; i++){
				if(list[i].key==value){
					value = list[i].value;
				}
			}
			html += '<td><input type="text" readonly="readonly" value="'+value+'"></td>';	
		}else{
			html += '<td><select name='+formData.id+'>';
			var enumList = enumTypeMap[formData.id];
			for(var i=0; i<enumList.length; i++){
				html += '<option value="'+enumList[i].key+'">';
				html += enumList[i].value;
				html += '</option>';
			}
			html += '</select></td>';
			//html += '<td><input type="text" name="'+formData.id+'"></td>';			
		}
	}else if(formData.type.name=="textarea"){
		if(readOnly=='1'){
			html += '<td><textarea  readonly="readonly" style="margin: 0px; width: 275px; height: 114px;">'+((startFormDataValueMap[namesign] != undefined && startFormDataValueMap[namesign] != "")?startFormDataValueMap[namesign]:"")+'</textarea></td>';
		}else{
			html += '<td><textarea style="margin: 0px; width: 275px; height: 114px;" name="'+formData.id+'">'+formData.value+'</textarea></td>';
		}
	}else if(formData.type.name == 'file'){
		if(readOnly=='1'){
			html = '';
		}else{
			html += '<td>'+formData.value+'<input type="file" name="'+formData.id+'"/></td>';
		}
	}
	return html;
}

//提交事件
function completeZd(){
	var auditOpinion=$("textarea[name='auditOpinion']").val();
	var taskId = $("#auditTaskId").val();
	auditForm.action = "<%=request.getContextPath()%>/workprocess/complete/"+taskId;
	auditForm.submit();
	$("#submitClick").attr({"disabled":"disabled"});
	$("#saveTemporary").attr({"disabled":"disabled"});
}

//存为草稿
function temporary(){

	var taskId = $("#auditTaskId").val();
	auditForm.action = "<%=request.getContextPath()%>/workprocess/temporary/"+taskId;
	auditForm.submit();
}

$('.fujian_dialog').dialog({
	autoOpen:false,
	title:'附件列表',
	modal:true,
	resizable:false,
	width:400,
	height:300,
	buttons:{
		'关闭':function(){
			$('.fujian_dialog').dialog('close');
			},
		}
	});

$('.fujianXiazai').click(function(){
	$('.fujian_dialog').dialog('open');
});

function auditPage(pageType){
	//当前页
	var pageNow = parseInt($("#auditPageNow").html());
	//总页数
	var pageCount = parseInt($("#auditPageCount").html());
	//换页后的页数
	var newpageNow = pageNow;
	//判断向后向前翻页
	if(pageType == '1'){
		newpageNow = pageNow-1;
	}else{
		newpageNow = pageNow+1;
	}
	//换页后的页数小于1，则为1
	if(newpageNow < 1){
		newpageNow = 1;
	}
	//换页后的页数大于总页数，则为总页数
	if(newpageNow > pageCount){
		newpageNow = pageCount;
	}
	//换页后的页码等于当前页，不换也，反之，则换页
	if(newpageNow != pageNow ){
		$(".ul"+pageNow).hide();
		$(".ul"+newpageNow).show();
	}
	$("#auditPageNow").html(newpageNow);
}
</script>
</html>
